package com.server;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import com.dbserver.Condb;

public class InfoService {
	public Map getType()
	  {   
		Map map=new HashMap();
		//处理结果集
		Condb condb=new Condb();
	  	try {
	  	    String countSql="select id,name from servicetype";
	  	  	ResultSet rs=condb.query(countSql);
			while(rs.next())
			{
				map.put(rs.getInt("id"), rs.getString("name"));
			}
			rs.close();
			condb.close();
		} catch (SQLException e) {
			condb.close();
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return map;
	  }
	public Map getShop()
	  {   
		Map map=new HashMap();
		//处理结果集
		Condb condb=new Condb();
	  	try {
	  	    String countSql="select id,name from shopinfo";
	  	  	ResultSet rs=condb.query(countSql);
			while(rs.next())
			{
				map.put(rs.getInt("id"), rs.getString("name"));
			}
			rs.close();
			condb.close();
		} catch (SQLException e) {
			condb.close();
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return map;
	  }
	public Map getUser()
	  {   
		Map map=new HashMap();
		//处理结果集
		Condb condb=new Condb();
	  	try {
	  	    String countSql="select id,username from user";
	  	  	ResultSet rs=condb.query(countSql);
			while(rs.next())
			{
				map.put(rs.getInt("id"), rs.getString("username"));
			}
			rs.close();
			condb.close();
		} catch (SQLException e) {
			condb.close();
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return map;
	  }
}
